<?php
/*
	Copyright 2006, 2007, 2008, 2009, 2010 Bastiaan Grutters
    
    This file is part of Ages of Strife website.

    Ages of Strife website is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    Ages of Strife website is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Ages of Strife website.  If not, see <http://www.gnu.org/licenses/>.
 */
global $premium, $show_ads, $dal, $promotionPoints, $showPromotionTab, $highlight3;

if( isset( $_SESSION[ 'ruler_id' ] ) ) {
	$query = "SELECT under_attack, show_promotion_tab, promotion_points " .
			"FROM ruler " .
			"JOIN users ON users.user_id = ruler.user_id " .
			"WHERE ruler_id = " . $_SESSION[ 'ruler_id' ];
	$result = mysql_query( $query ) or die( "Query failed : " . mysql_error() );
	$row = mysql_fetch_array( $result, MYSQL_ASSOC );
	if( isset( $row[ 'under_attack' ] ) && $row[ 'under_attack' ] == 1 ) {
		$highlight3 = " highlight";
	}
	else {
		$highlight3 = "";
	}
	
	if( isset( $row[ 'show_promotion_tab' ] ) && $row[ 'show_promotion_tab' ] == 0 && $premium > 0 ) {
		$showPromotionTab = false;
	}
	else {
		$showPromotionTab = true;
	}
	
	if( isset( $row[ 'promotion_points' ] ) ) {
		$promotionPoints = $row[ 'promotion_points' ];
	}
	else {
		$promotionPoints = 0;
	}
}
?>
<div id="right" class="<?php ( ( !isset( $premium ) || $premium < 0 ) ) ? print( 'skyscraper-ad' ) : print( 'premium-box' ); ?>">
<?php
if( ( !isset( $premium ) || $premium < 0 ) && isset( $_SESSION[ 'user_id' ] ) && $_SESSION[ 'user_id' ] > 0 ) {
	$query = "SELECT open_shop FROM game";
	$result = mysql_query( $query ) or die( "Query failed : " . mysql_error() );
	$row = mysql_fetch_array( $result, MYSQL_ASSOC );
	if( $row[ 'open_shop' ] == 1 ) {
?>
			<div class="text-center premium-ad-box">
				<a href="../global/shop.php" title="No more ads and a better game experience!">
					<strong>
						<?php transprint( 'Purchase premium turns' ); ?>
					</strong>
				</a>
			</div>
<?php
	}
}
if( isset( $show_ads ) && $show_ads || !isset( $show_ads ) ) {
	$query = "SELECT adserver_delays FROM game";
	$result = mysql_query( $query ) or die( "Query failed : " . mysql_error() );
	$row = mysql_fetch_array( $result, MYSQL_ASSOC );

	if( $row[ 'adserver_delays' ] < 3) {
?>
		<!-- Begin Project Wonderful ad code: -->
		<!-- IMPORTANT: All lines, including these comments, must be included. -->
		<!-- Removing or altering them could result in your ads being automatically shut down! -->
		<!-- Ad box ID: 2526 -->
		<script language='JavaScript' type='text/javascript'>
		// <![CDATA[
		r = new String (Math.random()*1000);
		r = r.substr(0, 5);
		s = new String ("<script language='JavaScript' type='text/javascript'");
		s += "src = http://www.projectwonderful.com/gen.php";
		s += "?id=2526&amp;type=3";
		s += "&amp;r=" + r;
		if (document.referrer){
		s += "&amp;referer=" + escape(document.referrer);
		}
		s += "><\/scr";
		s += "ipt>";
		document.write(s);
		// ]]>
		</script>
		<noscript><map name="admap2526" id="admap2526"><area href="http://www.projectwonderful.com/out_nojs.php?r=0&amp;c=0&amp;id=2526&amp;type=3" shape="rect" coords="0,0,160,600" title="" alt="" target="_blank" /></map>
		<table cellpadding="0" border="0" cellspacing="0" width="160" bgcolor="#CCAC5E"><tr><td><img src="http://www.projectwonderful.com/nojs.php?id=2526&amp;type=3" width="160" height="600" usemap="#admap2526" border="0" alt="" /></td></tr><tr><td bgcolor="#CCAC5E" colspan="1"><center><a style="font-size:10px;color:#000000;text-decoration:none;line-height:1.2;font-weight:bold;font-family:Tahoma, verdana,arial,helvetica,sans-serif;" href="http://www.projectwonderful.com/advertisehere.php?id=2526&amp;type=3" target="_blank">Your ad here, right now, for as low as $0.00</a></center></td></tr></table>
		</noscript>
		<!-- End Project Wonderful ad code. -->
<?php			
	}
	else {
?>
		<a target="_blank" href="http://apps.facebook.com/villageplanner/" title="Play VillagePlanner">
			<img src="/resources/skyscraper_160x600.jpg" alt="Play VillagePlanner" />
		</a>
<?php		
	}
}
else {
	if( isset( $_SESSION[ 'ruler_id' ] ) ) {
		$season = getSeasonString();
	   $turn = getCurrentTurn();
		$query = "SELECT * " .
				"FROM ruler " .
				"WHERE ruler_id = " . $_SESSION[ 'ruler_id' ];
		$result = mysql_query( $query ) or die( "Query failed : " . mysql_error() );
		$row = mysql_fetch_array( $result, MYSQL_ASSOC );
		
		$score = $row[ 'score' ];
		$battlescore = $row[ 'experience' ];
		$recentBattlescore = $row[ 'experience' ] - $row[ 'experience_before' ];
		
		$query2 = "SELECT count(*) " .
				"FROM ruler " .
				"WHERE score > " . $row[ 'score' ];
		$result2 = mysql_query( $query2 ) or die( "Query failed : " . mysql_error() );
		$row2 = mysql_fetch_array( $result2, MYSQL_ASSOC );
		$score_rank = $row2[ 'count(*)' ] + 1;
		
		if( $row[ 'experience' ] == 0 ) {
			$battle_rank = '-';
			$war_points = '-';
			$war_rank = '-';
		}
		else {
			$query2 = "SELECT count(*) FROM ruler WHERE experience > " . $row[ 'experience' ];
			$result2 = mysql_query( $query2 ) or die( "Query failed : " . mysql_error() );
			$row2 = mysql_fetch_array( $result2, MYSQL_ASSOC );
			$battle_rank = $row2[ 'count(*)' ] + 1;
			$war_points = $row[ 'warrior_points' ];
			$query2 = "SELECT count(*) FROM ruler WHERE warrior_points > " . $row[ 'warrior_points' ];
			$result2 = mysql_query( $query2 ) or die( "Query failed : " . mysql_error() );
			$row2 = mysql_fetch_array( $result2, MYSQL_ASSOC );
			$war_rank = $row2[ 'count(*)' ] + 1;
		}
		
		$economy_points = $row[ 'economy_points' ];
		
		$query2 = "SELECT count(*) FROM ruler WHERE economy_points > " . $row[ 'economy_points' ];
		$result2 = mysql_query( $query2 ) or die( "Query failed : " . mysql_error() );
		$row2 = mysql_fetch_array( $result2, MYSQL_ASSOC );
		$economy_rank = $row2[ 'count(*)' ] + 1;
		
		$reputation = get_reputation_string( $row[ 'score' ], $row[ 'experience' ] );
		
		$max_villages = getVillageLimit();
		$query2 = "SELECT count(*) FROM village WHERE ruler_id = " . $_SESSION[ 'ruler_id' ];
		$result2 = mysql_query( $query2 ) or die( "Query failed : " . mysql_error() );
		$row2 = mysql_fetch_array( $result2, MYSQL_ASSOC );
		$number_of_villages = $row2[ 'count(*)' ];
		
		$maxArmies = $number_of_villages * 2;
		$query2 = "SELECT count(*) FROM army WHERE ruler_id = " . $_SESSION[ 'ruler_id' ];
		$result2 = mysql_query( $query2 ) or die( "Query failed : " . mysql_error() );
		$row2 = mysql_fetch_array( $result2, MYSQL_ASSOC );
		$number_of_armies = $row2[ 'count(*)' ];
	
		$query2 = "SELECT count(*) FROM officers WHERE ruler_id = " . $_SESSION[ 'ruler_id' ];
		$result2 = mysql_query( $query2 ) or die( "Query failed : " . mysql_error() );
		$row2 = mysql_fetch_array( $result2, MYSQL_ASSOC );
		$number_of_officers = $row2[ 'count(*)' ];
		
		$query2 = "SELECT name, upgrades.upgrade_id, upgrade_status.time " .
					"FROM upgrade_status " .
					"JOIN upgrades ON upgrades.upgrade_id = upgrade_status.upgrade_id " .
					"WHERE achieved = 0 AND ruler_id = " . $_SESSION[ 'ruler_id' ] . " " .
					"ORDER BY rank ASC LIMIT 1";
		$result2 = mysql_query( $query2 ) or die( "Query failed : " . mysql_error() );
		$row2 = mysql_fetch_array( $result2, MYSQL_ASSOC );
		if( isset( $row2[ 'name' ] ) ) {
			if( $row2[ 'time' ] == -1 ) {
				$upgrade = "<a href=\"../upgrade/upgradeinfo.php?id=" . $row2[ 'upgrade_id' ] . "\">" . translate( $row2[ 'name' ] ) . " (-)</a>";
			}
			else {
				$upgrade = "<a href=\"../upgrade/upgradeinfo.php?id=" . $row2[ 'upgrade_id' ] . "\">" . translate( $row2[ 'name' ] ) . " (" . number_format( $row2[ 'time' ] ) . ")</a>";
			}
		}
		else {
			$upgrade = "<a href=\"../upgrade/upgrade.php\">" . translate( 'Nothing' ) . "</a>";
		}
		$query2 = "SELECT count(*) " .
					"FROM upgrade_status " .
					"WHERE achieved = 0 AND ruler_id = " . $_SESSION[ 'ruler_id' ];
		$result2 = mysql_query( $query2 ) or die( "Query failed : " . mysql_error() );
		$row2 = mysql_fetch_array( $result2, MYSQL_ASSOC );
		$queued_upgrades = "<a href=\"../upgrade/upgrade.php\">" . translate( 'Currently upgrading' ) . " (" . $row2[ 'count(*)' ] . ")</a>";
	
		$query2 = "SELECT name, expeditions.expedition_id, complete_turn, started " .
					"FROM ruler_expedition " .
					"JOIN expeditions ON expeditions.expedition_id = ruler_expedition.expedition_id " .
					"WHERE started = 1 AND completed = 0 AND ruler_id = " . $_SESSION[ 'ruler_id' ] . " " .
					"LIMIT 1";
		$result2 = mysql_query( $query2 ) or die( "Query failed : " . mysql_error() );
		$row2 = mysql_fetch_array( $result2, MYSQL_ASSOC );
		if( isset( $row2[ 'name' ] ) ) {
			if( $row2[ 'started' ] == 1 && $row2[ 'complete_turn' ] > $turn ) {
				$expedition_ready_in = number_format( $row2[ 'complete_turn' ] - $turn );
				$expedition = "<a href=\"../operations/expedition.php?id=" . $row2[ 'expedition_id' ] . "\">" . translate( $row2[ 'name' ] ) . " ($expedition_ready_in)</a>";
			}
			else {
				$expedition = "<a href=\"../operations/expedition.php?id=" . $row2[ 'expedition_id' ] . "\">" . translate( $row2[ 'name' ] ) . " (-)</a>";
			}
		}
		else {
			$expedition = "<a href=\"../operations/expeditions.php\">" . translate( 'Nothing' ) . "</a>";
		}
		$query2 = "SELECT count(*) " .
					"FROM ruler_expedition " .
					"WHERE completed = 0 AND ruler_id = " . $_SESSION[ 'ruler_id' ];
		$result2 = mysql_query( $query2 ) or die( "Query failed : " . mysql_error() );
		$row2 = mysql_fetch_array( $result2, MYSQL_ASSOC );
		$queued_expeditions = "<a href=\"../operations/expeditions.php\">" . translate( 'Current expedition' ) . " (" . $row2[ 'count(*)' ] . ")</a>";
		
		$blank_line = "<tr><td>&nbsp;</td><td>&nbsp;</td></tr>";
		$blank_line_even = "<tr class=\"even\"><td>&nbsp;</td><td>&nbsp;</td></tr>";
		
		$query2 = "SELECT ruler.name, ruler.active_turn " .
					"FROM buddy " .
					"JOIN users ON ( users.user_id = buddy.user_id1 OR users.user_id = buddy.user_id2 ) " .
					"JOIN ruler ON users.user_id = ruler.user_id " .
					"WHERE ( user_id1 = " . $_SESSION[ 'user_id' ] . " OR user_id2 = " . $_SESSION[ 'user_id' ] . " ) AND " .
							"turn1 = 1 AND turn2 = 1 AND ruler1 = 1 AND ruler2 = 1 AND users.user_id != " . $_SESSION[ 'user_id' ] . " " .
					"ORDER BY active_turn DESC " .
					"LIMIT 5";
		//print( "Query: $query2 <br />" );
		$result2 = mysql_query( $query2 ) or die( "Query failed : " . mysql_error() );
	   $buddies = Array();
	   while ( $row = mysql_fetch_object( $result2 ) ) {
			$buddies[] = $row;
	   }
	    
		$statement = $dal->prepare( 'SELECT turn ' .
				'FROM premium_stats ' .
				'WHERE ruler_id = :ruler_id AND turn < :turn ' .
				'ORDER BY turn DESC ' .
				'LIMIT 1' );
		$statement->bindParam( ':ruler_id', $_SESSION[ 'ruler_id' ], PDO::PARAM_INT );
		$statement->bindParam( ':turn', $turn, PDO::PARAM_INT );
		$statsTurn = $dal->getValue( $statement );
		
		if( isset( $statsTurn ) ) {
			$statsArray = Array();
			$statement = $dal->prepare( 'SELECT value, type ' .
					'FROM premium_stats ' .
					'WHERE ruler_id = :ruler_id AND turn = :turn ' .
					'ORDER BY type ASC' );
			$statement->bindParam( ':ruler_id', $_SESSION[ 'ruler_id' ], PDO::PARAM_INT );
			$statement->bindParam( ':turn', $statsTurn, PDO::PARAM_INT );
			$stats = $dal->getArrayOfObjects( $statement );
			foreach( $stats AS $stat ) {
				if( $stat->type == 1 && $stat->value > $score ) {
					$score = '<strong class="point-down">&nbsp;</strong>' . number_format( $score );
				}
				elseif( $stat->type == 1 && $stat->value < $score ) {
					$score = '<strong class="point-up">&nbsp;</strong>' . number_format( $score );
				}
				elseif( $stat->type == 1 ) {
					$score = '<strong class="equal">&nbsp;</strong>' . number_format( $score );
				}
				elseif( $stat->type == 2 && $stat->value > $battlescore ) {
					$battlescore = '<strong class="point-down">&nbsp;</strong>' . number_format( $battlescore );
				}
				elseif( $stat->type == 2 && $stat->value < $battlescore ) {
					$battlescore = '<strong class="point-up">&nbsp;</strong>' . number_format( $battlescore );
				}
				elseif( $stat->type == 2 ) {
					$battlescore = '<strong class="equal">&nbsp;</strong>' . number_format( $battlescore );
				}
				elseif( $stat->type == 5 && $stat->value < $score_rank ) {
					$score_rank = '<strong class="point-down">&nbsp;</strong>' . number_format( $score_rank );
				}
				elseif( $stat->type == 5 && $stat->value > $score_rank ) {
					$score_rank = '<strong class="point-up">&nbsp;</strong>' . number_format( $score_rank );
				}
				elseif( $stat->type == 5 ) {
					$score_rank = '<strong class="equal">&nbsp;</strong>' . number_format( $score_rank );
				}
				elseif( $stat->type == 6 && $battle_rank != '-' && $stat->value < $battle_rank ) {
					$battle_rank = '<strong class="point-down">&nbsp;</strong>' . number_format( $battle_rank );
				}
				elseif( $stat->type == 6 && $battle_rank != '-' && $stat->value > $battle_rank ) {
					$battle_rank = '<strong class="point-up">&nbsp;</strong>' . number_format( $battle_rank );
				}
				elseif( $stat->type == 6 && $battle_rank != '-' ) {
					$battle_rank = '<strong class="equal">&nbsp;</strong>' . number_format( $battle_rank );
				}
				elseif( $stat->type == 7 && $stat->value > $economy_points ) {
					$economy_points = '<strong class="point-down">&nbsp;</strong>' . number_format( $economy_points );
				}
				elseif( $stat->type == 7 && $stat->value < $economy_points ) {
					$economy_points = '<strong class="point-up">&nbsp;</strong>' . number_format( $economy_points );
				}
				elseif( $stat->type == 7 ) {
					$economy_points = '<strong class="equal">&nbsp;</strong>' . number_format( $economy_points );
				}
				elseif( $stat->type == 8 && $war_points != '-' && $stat->value > $war_points ) {
					$war_points = '<strong class="point-down">&nbsp;</strong>' . number_format( $war_points );
				}
				elseif( $stat->type == 8 && $war_points != '-' && $stat->value < $war_points ) {
					$war_points = '<strong class="point-up">&nbsp;</strong>' . number_format( $war_points );
				}
				elseif( $stat->type == 8 && $war_points != '-' ) {
					$war_points = '<strong class="equal">&nbsp;</strong>' . number_format( $war_points );
				}
				elseif( $stat->type == 9 && $economy_rank != '-' && $stat->value < $economy_rank ) {
					$economy_rank = '<strong class="point-down">&nbsp;</strong>' . number_format( $economy_rank );
				}
				elseif( $stat->type == 9 && $economy_rank != '-' && $stat->value > $economy_rank ) {
					$economy_rank = '<strong class="point-up">&nbsp;</strong>' . number_format( $economy_rank );
				}
				elseif( $stat->type == 9 && $economy_rank != '-' ) {
					$economy_rank = '<strong class="equal">&nbsp;</strong>' . number_format( $economy_rank );
				}
				elseif( $stat->type == 10 && $war_rank != '-' && $stat->value < $war_rank ) {
					$war_rank = '<strong class="point-down">&nbsp;</strong>' . number_format( $war_rank );
				}
				elseif( $stat->type == 10 && $war_rank != '-' && $stat->value > $war_rank ) {
					$war_rank = '<strong class="point-up">&nbsp;</strong>' . number_format( $war_rank );
				}
				elseif( $stat->type == 10 && $war_rank != '-' ) {
					$war_rank = '<strong class="equal">&nbsp;</strong>' . number_format( $war_rank );
				}
			}
		}
		else {
			$score = number_format( $score );
			$battlescore = number_format( $battlescore );
			$score_rank = number_format( $score_rank );
			if( $battle_rank != '-' ) {
				$battle_rank = number_format( $battle_rank );
			}
			$economy_points = number_format( $economy_points );
			if( $war_points != '-' ) {
				$war_points = number_format( $war_points );
			}
			if( $war_rank != '-' ) {
				$war_rank = number_format( $war_rank );
			}
			if( $economy_rank != '-' ) {
				$economy_rank = number_format( $economy_rank );
			}
		}
	    
?>
	<div id="right-info">
		<table id="premium-info-table">
			<tr>
				<td><?php transprint( 'Score' ); ?>:</td><td align="right"><?php print( $score ); ?></td>
			</tr>
			<tr class="even">
				<td><?php transprint( 'Rank' ); ?>:</td><td align="right"><?php print( $score_rank ); ?></td>
			</tr>
			<tr>
				<td><?php transprint( 'Battlescore' ); ?>:</td><td align="right"><?php print( $battlescore ); ?></td>
			</tr>
			<tr class="even">
				<td><a href="../aosmanual/concepts.php#new battlescore"><?php transprint( 'New battlescore' ); ?></a>:</td><td align="right"><?php print( number_format( $recentBattlescore ) ); ?></td>
			</tr>
			<tr>
				<td><?php transprint( 'Battlerank' ); ?>:</td><td align="right"><?php print( $battle_rank ); ?></td>
			</tr>
			<tr class="even">
				<td><a href="../aosmanual/reputation.php"><?php transprint( 'Reputation' ); ?></a>:</td><td align="right"><?php print( $reputation ); ?></td>
			</tr>
			<?php print( $blank_line ); ?>
			<tr class="even">
				<td><?php transprint( 'Economy points' ); ?>:</td><td align="right"><?php print( $economy_points ); ?></td>
			</tr>
			<tr>
				<td><?php transprint( 'Economy rank' ); ?>:</td><td align="right"><?php print( $economy_rank ); ?></td>
			</tr>
			<tr class="even">
				<td><?php transprint( 'War points' ); ?>:</td><td align="right"><?php print( $war_points ); ?></td>
			</tr>
			<tr>
				<td><?php transprint( 'War rank' ); ?>:</td><td align="right"><?php print( $war_rank ); ?></td>
			</tr>
			<?php print( $blank_line_even ); ?>
			<tr>
<?php
	$url = parse_url( $_SERVER[ 'REQUEST_URI' ] );
	$path = explode( '/', $url[ 'path' ] );
	if( count( $path > 1 ) ) {
		$path = $path[ count( $path ) - 2];
		//print( "Path: " . $path . "<br />\r\n" );
	}
	else {
		$path = "";
	}
	global $charts;
	$charts = false;
	if( !$show_ads && ( $path == 'overview' || $path == 'villages' || $path == 'armies' || $path == 'diplomacy' || $path == 'operations' ) ) {
?>
				<td colspan="2"><a href="javascript:void(null);" onclick="initializeChartsPanel();"><?php transprint( 'View charts' ); ?></a></td>
<?php
	}
	else {
?>
				<td colspan="2">&nbsp;</td>
<?php
	}
?>
			</tr>
			<?php print( $blank_line_even ); ?>
			<tr>
				<td><?php transprint( 'Season' ); ?>:</td><td align="right"><a href="../aosmanual/concepts.php#seasons"><?php transprint( $season ); ?></a></td>
			</tr>
			<?php print( $blank_line_even ); ?>
			<tr>
				<td><?php transprint( 'Villages' ); ?>:</td><td align="right"><?php print( $number_of_villages ); ?> <?php transprint( 'out of' ); ?> <?php print( $max_villages ); ?></td>
			</tr>
			<?php print( $blank_line_even ); ?>
			<tr>
				<td><?php transprint( 'Armies' ); ?>:</td><td align="right"><?php print( $number_of_armies ); ?> <?php transprint( 'out of' ); ?> <?php print( $maxArmies ); ?></td>
			</tr>
			<?php print( $blank_line_even ); ?>
			<tr>
				<td><?php transprint( 'Officers' ); ?>:</td><td align="right"><?php print( $number_of_officers ); ?> <?php transprint( 'out of' ); ?> <?php print( $maxArmies ); ?></td>
			</tr>
			<?php print( $blank_line_even ); ?>
			<tr>
				<td colspan="2"><?php print( $queued_upgrades ); ?>:</td>
			</tr>
			<tr>
				<td colspan="2"><?php print( $upgrade ); ?></td>
			</tr>
			<?php print( $blank_line_even ); ?>
			<tr>
				<td colspan="2"><?php print( $queued_expeditions ); ?>:</td>
			</tr>
			<tr>
				<td colspan="2"><?php print( $expedition ); ?></td>
			</tr>
			<?php print( $blank_line_even ); ?>
			
			<tr>
				<td><?php transprint( 'Buddies' ); ?></td><td align="right"><?php transprint( 'Activity' ); ?></td>
			</tr>
<?php 
		$even = true;
		
		for( $i = 0; $i < 5; $i ++ ) {
			if( count( $buddies ) > $i ) {
				if( $even ) {
					print( "<tr class=\"even\">" );
				}
				else {
					print( "<tr>" );
				}
				$even = !$even;
				print( "<td><a href=\"../overview/ruler.php?name=" . $buddies[$i]->name . "\">" . $buddies[$i]->name . "</a></td>" );
				$active = $turn - $buddies[$i]->active_turn;
				if( $active == 0 ) {
					$active = translate( "This game day" );
				}
				elseif( $active == 1 ) {
					$active = translate( "1 game day ago" );
				}
				else {
					$active = number_format( $active ) . " " . translate( "game days ago" );
				}
				$active = "<a href=\"../diplomacy/send_letter.php?to=" . $buddies[$i]->name . "\" title=\"Send a letter to " . $buddies[$i]->name . "\">" . $active . "</a>";
				print( "<td align=\"right\">" .$active . "</td>" );
				print( "</tr>\r\n" );
			}
			else {
				if( $even ) {
					print( $blank_line_even );
				}
				else {
					print( $blank_line );
				}
				$even = !$even;
			}
		}
?>
			<?php print( $blank_line ); ?>
			<tr class="even">
				<td><?php transprint( 'Premium turns' ); ?>:</td><td align="right"><?php print( number_format( $premium ) ); ?></td>
			</tr>
			<?php print( $blank_line ); ?>
<?php
	if( $showPromotionTab ) {
?>
			<tr class="even">
				<td><?php transprint( 'Promotion points' ); ?>:</td><td align="right"><?php print( number_format( $promotionPoints ) ); ?></td>
			</tr>
			<?php print( $blank_line ); ?>
<?php		
	}
?>
			<tr class="even">
				<td colspan="2"><a href="../global/shop.php"><?php transprint( 'Premium turns shop' ); ?></a></td>
			</tr>
		</table>
	</div>
<?php
	}
	else {
		transprint( "Premium account information will be available as soon as you sign up as a ruler." );
	}
}
?>
</div>
